<%--
  Created by IntelliJ IDEA.
  User: lijincheng
  Date: 2021/5/21
  Time: 11:16 上午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link href="/css/bootstrap.css" rel="stylesheet">
    <script src="/js/jquery-3.5.1.js" type="text/javascript"></script>
    <script src="/js/bootstrap.min.js" type="text/javascript"></script>
    <link href="/css/order/css.css" rel="stylesheet">
</head>
<body>
<div class="edit-address-info card" id="edit-name-div">
    <div class="col-xs-12 ">
        <h2 class="text-center">添加新地址</h2>
    </div>
    <div class="nav shade_content_div" style="margin-top: -5px">
        <div class="col-xs-12 shade_from">
            <form action="" method="post">
                <div class="col-xs-12">
                    <input class="input_style" type="" name="" id="edit_user_name" value=""
                           placeholder="&nbsp;&nbsp;请输入收件人"/>
                </div>
                <div class="col-xs-12">
                    <input class="input_style" type="" name="" id="edit_user_phone" value=""
                           placeholder="&nbsp;&nbsp;请输入联系电话"/>
                </div>
                <div class="col-xs-12">
                    <input class="input_style" type="" name="" id="edit_user_address" value=""
                           placeholder="&nbsp;&nbsp;请输入详细地址"/>
                </div>
                <div class="col-xs-12">
                    <input type="button" class="sub_set" onclick="add_address()"  value="提交"/>
                </div>
            </form>
        </div>
    </div>
</div>
<script>

    function add_address(){
        var name = $("#edit_user_name").val();
        var phone = $("#edit_user_phone").val();
        var address = $("#edit_user_address").val();
        $.ajax({
            type:"POST",
            data:{"recName":name,"recPhone":phone,"recAddress":address},
            url:"/address/addAddress",
            success:function (data){
                if (data.code == 0){
                    alert("添加成功");
                    $(":input").val("");
                }else {
                    alert(data.message);
                }
            }

        });
    }
</script>
</body>
</html>
